From 086789d01508ad1c96b0d94935095022193dd1a8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 4 Apr 2013 21:10:18 -0400 Subject: [PATCH] wayland: Always initialize directions I forgot to initialize directionm in gdk_wayland_keymap_new, leading to crash. --- gdk/wayland/gdkkeys-wayland.c | 48 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c index 83d94e9be5..f58d1b3e35 100644 --- a/gdk/wayland/gdkkeys-wayland.c +++ b/gdk/wayland/gdkkeys-wayland.c @@ -225,29 +225,6 @@ _gdk_wayland_keymap_init (GdkWaylandKeymap *keymap) { } -GdkKeymap * -_gdk_wayland_keymap_new () -{ - GdkWaylandKeymap *keymap; - struct xkb_context *context; - struct xkb_rule_names names; - - keymap = g_object_new (_gdk_wayland_keymap_get_type(), NULL); - - context = xkb_context_new (0); - - names.rules = "evdev"; - names.model = "pc105"; - names.layout = "us"; - names.variant = ""; - names.options = ""; - keymap->xkb_keymap = xkb_keymap_new_from_names (context, &names, 0); - keymap->xkb_state = xkb_state_new (keymap->xkb_keymap); - xkb_context_unref (context); - - return GDK_KEYMAP (keymap); -} - static void update_direction (GdkWaylandKeymap *keymap) { @@ -317,6 +294,31 @@ update_direction (GdkWaylandKeymap *keymap) g_free (rtl); } +GdkKeymap * +_gdk_wayland_keymap_new () +{ + GdkWaylandKeymap *keymap; + struct xkb_context *context; + struct xkb_rule_names names; + + keymap = g_object_new (_gdk_wayland_keymap_get_type(), NULL); + + context = xkb_context_new (0); + + names.rules = "evdev"; + names.model = "pc105"; + names.layout = "us"; + names.variant = ""; + names.options = ""; + keymap->xkb_keymap = xkb_keymap_new_from_names (context, &names, 0); + keymap->xkb_state = xkb_state_new (keymap->xkb_keymap); + xkb_context_unref (context); + + update_direction (keymap); + + return GDK_KEYMAP (keymap); +} + void _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap, uint32_t format, -- 2.30.2